const nameSS = {
  ordid: 'ordid',                   // 订单 id
  musicLabelIds: 'musicLabelIds',   // 选中的音乐标签
  orderItems:'orderItems'           // 订单数据 items
}

const nameLS = {
  token: 'token',                   // token
  isAuth: 'isAuth',                 // 是否实名认证
  workSearchMap: 'workSearchMap',   // 作品搜索记录 { video: [], music: [], picture: [], insp: [] }
}

// sessionStorage 封装
const getSS = (key) => { try { return JSON.parse(sessionStorage.getItem(key)) } catch (e) { return sessionStorage.getItem(key)} }
const setSS = (key, value) => sessionStorage.setItem(key, JSON.stringify(value))
const rmSS = (key) => sessionStorage.removeItem(key)

// localStorage 封装
const getLS = (key) => { try { return JSON.parse(localStorage.getItem(key)) } catch (e) { return localStorage.getItem(key)} }
const setLS = (key, value) => localStorage.setItem(key, JSON.stringify(value))
const rmLS = (key) => localStorage.removeItem(key)

export const ss = {
  ...nameSS,
  get: getSS,
  set: setSS,
  rm: rmSS,
}

export const ls = {
  ...nameLS,
  get: getLS,
  set: setLS,
  rm: rmLS,
}